// eslint-disable-next-line
const debounce = function(fn, wait) {
  let timer = null;
  // eslint-disable-next-line
  return function(...params) {
    if (timer) {
      clearTimeout(timer);
      timer = null;
    }

    timer = setTimeout(() => {
      fn.call(this, ...params);
      // fn(...params);
    }, wait);
  };
};

export default debounce;
